package com.sojson.service.impl;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sojson.dao.AuthDao;
import com.sojson.entity.po.Auth;
import com.sojson.service.AuthService;

/**
 * 权限表Service实现类
 * 
 * @author liu
 * @date 2021-03-16
 */
@Service
public class AuthServiceImpl implements AuthService {

    @Resource
    private AuthDao authDaoImpl;

    /**
     * 单条插入
     * 
     * @param auth
     * @return
     * @throws SQLException
     */
    @Override
    public int insert(Auth auth) {
        int insert = authDaoImpl.insert(auth);
        return insert;
    }

    /**
     * 批量插入
     * 
     * @param auth
     * @return
     * @throws SQLException
     */
    @Override
    public int insertList(Auth auth) {
        int insertList = authDaoImpl.insertList(auth.getAuths());
        return insertList;
    }

    /**
     * 通过对象批量删除(物理删除)
     * 
     * @param auth
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteByDto(Auth auth) {
        int deleteByDto = authDaoImpl.deleteByDto(auth);
        return deleteByDto;
    }

    /**
     * 统计全部数量
     * 
     * @return
     * @throws SQLException
     */
    @Override
    public int countAll() {
        int countAll = authDaoImpl.countAll();
        return countAll;
    }

    /**
     * 查询所有
     * 
     * @return
     * @throws SQLException
     */
    @Override
    public List<Auth> findAll() {
        List<Auth> findAll = authDaoImpl.listAll();
        return findAll;
    }

    /**
     * 根据对象统计数量
     * 
     * @param auth
     * @return
     * @throws SQLException
     */
    @Override
    public int countByDto(Auth auth) {
        int countByDto = authDaoImpl.countByDto(auth);
        return countByDto;
    }

    /**
     * 根据对象查询
     * 
     * @param auth
     * @return
     * @throws SQLException
     */
    @Override
    public List<Auth> findByDto(Auth auth) {
        List<Auth> findByDto = authDaoImpl.listByDto(auth);
        return findByDto;
    }

    /**
     * 通过id删除(物理删除)
     * 
     * @param id
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteById(Integer id) {
        int deleteById = authDaoImpl.deleteById(id);
        return deleteById;
    }

    /**
     * 通过id列表删除(物理删除)
     * 
     * @param ids
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteByIdList(ArrayList<Integer> ids) {
        int deleteByIdList = authDaoImpl.deleteByIdList(ids);
        return deleteByIdList;
    }

    /**
     * 通过id更新(全部更新)
     * 
     * @param auth
     * @return
     * @throws SQLException
     */
    @Override
    public int updateById(Auth auth) {
        int updateById = authDaoImpl.updateById(auth);
        return updateById;
    }

    /**
     * 通过id列表更新(全部更新)(更新内容相同)
     * 
     * @param auth
     * @return
     * @throws SQLException
     */
    @Override
    public int updateStaticByIdList(Auth auth) {
        int updateStaticByIdList = authDaoImpl.updateStaticByIdList(auth);
        return updateStaticByIdList;
    }

    /**
     * 通过id列表更新(全部更新)(更新内容不相同)
     * 
     * @param auth
     * @return
     * @throws SQLException
     */
    @Override
    public int updateChangeByIdList(Auth auth) {
        int updateChangeByIdList = authDaoImpl.updateChangeByIdList(auth.getAuths());
        return updateChangeByIdList;
    }

    /**
     * 通过id更新(局部更新)
     * 
     * @param auth
     * @return
     * @throws SQLException
     */
    @Override
    public int updatePartialById(Auth auth) {
        int updatePartialById = authDaoImpl.updatePartialById(auth);
        return updatePartialById;
    }

    /**
     * 通过id列表更新(局部更新)(更新内容相同)
     * 
     * @param auth
     * @return
     * @throws SQLException
     */
    @Override
    public int updateStaticPartialByIdList(Auth auth) {
        int updateStaticPartialByIdList = authDaoImpl.updateStaticPartialByIdList(auth);
        return updateStaticPartialByIdList;
    }

    /**
     * 通过id列表更新(局部更新)(更新内容不相同)
     * 
     * @param auth
     * @return
     * @throws SQLException
     */
    @Override
    public int updateChangePartialByIdList(Auth auth) {
        int updateChangePartialByIdList = authDaoImpl.updateChangePartialByIdList(auth.getAuths());
        return updateChangePartialByIdList;
    }

    /**
     * 通过id查询
     * 
     * @param id
     * @return
     * @throws SQLException
     */
    @Override
    public Auth findById(Integer id) {
        Auth findById = authDaoImpl.findById(id);
        return findById;
    }

    /**
     * 通过id列表查询
     * 
     * @param ids
     * @return
     * @throws SQLException
     */
    @Override
    public ArrayList<Auth> findByIdList(ArrayList<Integer> ids) {
        ArrayList<Auth> findByIdList = authDaoImpl.findByIdList(ids);
        return findByIdList;
    }

    /**
     * 通过对象查询id列表
     * 
     * @param auth
     * @return
     * @throws SQLException
     */
    @Override
    public ArrayList<Integer> findIdByDto(Auth auth) {
        ArrayList<Integer> findIdByDto = authDaoImpl.findIdByDto(auth);
        return findIdByDto;
    }

    /**
     * 清空数据(物理清空)
     * 
     * @throws SQLException
     */
    @Override
    public void clear() {
        authDaoImpl.clear();
    }

}